package ydj.cloud.example.example.controller;

import ydj.cloud.example.example.config.ExtendConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class SampleConroller {

    @Value(value = "${user.name}")
    private String name;

    @Value(value = "${user.phone}")
    private String phone;

    @Autowired
    private ExtendConfig extendConfig;

    @GetMapping(value = "/user")
    public String simple() {
        System.out.println(extendConfig.getId());
        System.out.println(name);
        System.out.println(phone);
        return "OK";
    }
}
